﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebStore.Domain.Entities.Model
{
    public class Product
    {
        public int Id { get; set; }
    
        public string Name { get; set; }
        
        public string Description { get; set; }
        
        public decimal Price { get; set; }

        public byte[] Photo { get; set; }

        public int Quantity { get; set; }

        public bool IsDeleted { get; set; }

        public int CategoryId { get; set; }
        public virtual Category Category { get; set; }
    }

    public class ProductConfiguration:EntityTypeConfiguration<Product>
    {
        public ProductConfiguration()
        {
            HasRequired(x => x.Category).WithMany().HasForeignKey(x => x.CategoryId);
        }
    }
}
